<template>
    <template v-for="menu in props.menus" :key="menu.id">
        <el-sub-menu v-if="menu.children" :index="menu.id">
            <template #title>
                <el-icon v-if="menu.icon">
                    <component :is="menu.icon"></component>
                </el-icon>
                <span>{{ menu.name }}</span>
            </template>
            <AsideMenu :menus="menu.children" />
        </el-sub-menu>
        <el-menu-item v-else :index="menu.router">
            <el-icon v-if="menu.icon">
                <component :is="menu.icon"></component>
            </el-icon>
            <template #title>{{ menu.name }}</template>
        </el-menu-item>
    </template>
</template>

<script setup lang="ts">
const props = defineProps<{
    menus: MenuList[]
}>()
</script>

<style lang="scss" scoped></style>